<?php
namespace app\models;

use yii\db\ActiveRecord;

class Category extends ActiveRecord
{
    public function getArticles()
    {
//        return $this->hasMany(Article::className(),['cate_id'=>'cid'])->asArray()->all();

        //会自动调用all()方法
        return $this->hasMany(Article::className(),['cate_id'=>'cid'])->asArray();

    }
}
